package com.sino.struts2;

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;
import com.sino.business.IJjxyInfoService;
import com.sino.model.JjxyInfoModel;

public class JjxyAction extends ActionSupport{
	
	private IJjxyInfoService jjxyInfoService = null;
	
	private JjxyInfoModel jjxyInfoModel = null;
	private String zlid;
	
	private String jjxyFb ="0";//经济效益分表标识。0，2，3，4，5，
	
	private String saveBZ="next";//如果jjxyFb为save，保存后还跳转到当前页面
	
	
	//------------------------显示经济效益信息
	public String viewJjxyInfo(){
		return this.SUCCESS;
	}
	//------------------------显示经济效益分表信息
	public String viewJjxyInfo2(){
		return this.SUCCESS;
	}
	
	//------------------------保存经济效益信息
	public String saveJjxyInfo(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid");
		jjxyInfoModel.setZlId(zlId);
		this.getJjxyInfoService().saveJjxyInfo(jjxyInfoModel);
		return this.SUCCESS;
	}
	//------------------------保存经济效益分表信息
	public String saveJjxyInfo2(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid");
		jjxyInfoModel.setZlId(zlId);
		this.getJjxyInfoService().saveJjxyInfo(jjxyInfoModel);
		this.setJjxyFb(jjxyInfoModel.getBsw());
		if(this.saveBZ.equals("save")){
			return this.INPUT;
		}else{
			return this.SUCCESS;
		}
	}
	//------------------------更新经济效益信息
	public String updateJjxyInfo(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid2");
		jjxyInfoModel.setZlId(zlId);
		this.getJjxyInfoService().saveJjxyInfo(jjxyInfoModel);
		return this.SUCCESS;
	}
	//------------------------更新经济效益分表信息
	public String updateJjxyInfo2(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid2");
		jjxyInfoModel.setZlId(zlId);
		this.getJjxyInfoService().saveJjxyInfo(jjxyInfoModel);
		return this.SUCCESS;
	}
	//------------------------查找经济效益总表信息
	public String findJjxyInfo(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid");
		this.setJjxyInfoModel(this.getJjxyInfoService().findJjxyByZlId(zlId, "1"));
		//System.out.println("aaa"+this.getJjxyInfoModel().getLxdh()+this.getJjxyInfoModel().getShxy());
		return this.SUCCESS;
	}
	public String findJjxyInfoToPrint(){
		
		this.setJjxyInfoModel(this.getJjxyInfoService().findJjxyByZlId(zlid, "1"));
		//System.out.println("aaa"+this.getJjxyInfoModel().getLxdh()+this.getJjxyInfoModel().getShxy());
		return this.SUCCESS;
	}
	//------------------------查找经济效益分表信息
	public String findJjxyInfo2(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid");
		this.setJjxyInfoModel(this.getJjxyInfoService().findJjxyByZlId(zlId, this.jjxyFb));
		return this.SUCCESS;
	}
	public String findJjxyInfoToPrint2(){
		
		this.setJjxyInfoModel(this.getJjxyInfoService().findJjxyByZlId(zlid, this.jjxyFb));
		//System.out.println("aaa"+this.getJjxyInfoModel().getLxdh()+this.getJjxyInfoModel().getShxy());
		return this.SUCCESS;
	}
	//------------------------查找经济效益总表信息--用于更新
	public String findUpdateJjxyInfo(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid2");
		this.setJjxyInfoModel(this.getJjxyInfoService().findJjxyByZlId(zlId, "1"));
		return this.SUCCESS;
	}
	//------------------------查找经济效益分表信息---用于更新
	public String findUpdateJjxyInfo2(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid2");
		this.setJjxyInfoModel(this.getJjxyInfoService().findJjxyByZlId(zlId, this.jjxyFb));
		return this.SUCCESS;
	}
	//--------------------------------------接口
	public JjxyInfoModel getJjxyInfoModel() {
		return jjxyInfoModel;
	}
	public void setJjxyInfoModel(JjxyInfoModel jjxyInfoModel) {
		this.jjxyInfoModel = jjxyInfoModel;
	}
	public IJjxyInfoService getJjxyInfoService() {
		return jjxyInfoService;
	}
	public void setJjxyInfoService(IJjxyInfoService jjxyInfoService) {
		this.jjxyInfoService = jjxyInfoService;
	}
	public String getZlid() {
		return zlid;
	}
	public void setZlid(String zlid) {
		this.zlid = zlid;
	}
	public String getJjxyFb() {
		return jjxyFb;
	}
	public void setJjxyFb(String jjxyFb) {
		this.jjxyFb = jjxyFb;
	}
	public String getSaveBZ() {
		return saveBZ;
	}
	public void setSaveBZ(String saveBZ) {
		this.saveBZ = saveBZ;
	}
}
